package views;

import javax.swing.JPanel;

import views.activity.*;

public class MainView extends JPanel {
	
	public SearchActivityView dueActivityView;
	public AddActivityView addActivityView;
	public SearchActivityView searchActivityView;
	
	public MainView() {
		this.setName("Main");
		this.setSize(770, 480);
		this.setLayout(null);
		
		dueActivityView = new SearchActivityView();
		dueActivityView.setBounds(10, 10, 750, 460);
		dueActivityView.lblSearchForAnActivity.setText("Activities with due requirements");
		dueActivityView.lblProgram.setVisible(false);
		dueActivityView.rdbtnCurriculumbasedActivity.setVisible(false);
		dueActivityView.rdbtnVolunteerbasedActivity.setVisible(false);
		dueActivityView.btnReturnToMain.setVisible(false);
		this.add(dueActivityView);
	}
	
	public void removeComponents() {
		if (this.getComponentCount() > 0) {
			this.removeAll();
		}
	}
	
	public void displayDueActivityView() {
		removeComponents();
		
		this.add(dueActivityView);
		this.updateUI();
	}
	
	public void displayAddActivityView(AddActivityView addActivityView) {
		removeComponents();
		
		this.addActivityView = addActivityView;
		this.addActivityView.setBounds(10, 10, 750, 460);
		this.add(addActivityView);
		this.updateUI();
	}
	
	public void displaySearchActivityView(SearchActivityView searchActivityView) {
		removeComponents();
		
		this.searchActivityView = searchActivityView;
		this.searchActivityView.setBounds(10, 10, 750, 460);
		this.add(searchActivityView);
		this.updateUI();
	}
}
